/**
 * 加密模块
 */
import JSEncrypt from 'jsencrypt';
if (!JSEncrypt) {
    throw new Error('你须先运行 npm install `jsencrypt` --save ');
}
class encryptionRAS {
    [x: string]: any;
    constructor() {
        this.encryptor = new JSEncrypt();
    }
    // 加密
    public encrypt = (txt: any) => {
        this.encryptor.setPublicKey(CONFIG.publicKey); // 设置公钥
        return this.encryptor.encrypt(txt); // 对数据进行加密
    };
    // 解密
    public decrypt = (txt: any) => {
        this.encryptor.setPrivateKey(CONFIG.privateKey); // 设置私钥
        return this.encryptor.decrypt(txt); // 对数据进行解密
    };
}
export default new encryptionRAS();
